/**
 * 
 */
package com.bestbuy.pojo;


import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * @author ThanhNgo
 *
 */
@Entity
@Table(name = "promotion")
public class Promotion {
	@Id
	@Column(name = "IDPROMOTION")
	@GeneratedValue
	private Integer idpromtion;
	
	@Column(name = "DISCOUNT")
	private float discount;
	
	@Column(name = "DATESTART")
	private Date datestart;
	
	@Column(name = "DATEEND")
	private Date dateend;

	@OneToMany(mappedBy="promotion", fetch = FetchType.LAZY)
    private Set<Product> products = new HashSet<Product>(0);
	/**
	 * @return the products
	 */
	public Set<Product> getProducts() {
		return products;
	}

	/**
	 * @param products the products to set
	 */
	public void setProducts(Set<Product> products) {
		this.products = products;
	}

	/**
	 * @return the idpromtion
	 */
	public Integer getIdpromtion() {
		return idpromtion;
	}

	/**
	 * @param idpromtion the idpromtion to set
	 */
	public void setIdpromtion(Integer idpromtion) {
		this.idpromtion = idpromtion;
	}

	/**
	 * @return the discount
	 */
	public float getDiscount() {
		return discount;
	}

	/**
	 * @param discount the discount to set
	 */
	public void setDiscount(float discount) {
		this.discount = discount;
	}

	/**
	 * @return the datestart
	 */
	public Date getDatestart() {
		return datestart;
	}

	/**
	 * @param datestart the datestart to set
	 */
	public void setDatestart(Date datestart) {
		this.datestart = datestart;
	}

	/**
	 * @return the dateend
	 */
	public Date getDateend() {
		return dateend;
	}

	/**
	 * @param dateend the dateend to set
	 */
	public void setDateend(Date dateend) {
		this.dateend = dateend;
	}

	/**
	 * @param idpromtion
	 * @param discount
	 * @param datestart
	 * @param dateend
	 * @param products
	 */
	public Promotion(Integer idpromtion, float discount, Date datestart,
			Date dateend, Set<Product> products) {
		super();
		this.idpromtion = idpromtion;
		this.discount = discount;
		this.datestart = datestart;
		this.dateend = dateend;
		this.products = products;
	}

	/**
	 * 
	 */
	public Promotion() {
		// TODO Auto-generated constructor stub
	}
	
	
}
